package com.ellecity06.cwhiskymall.view.dialog

import android.view.LayoutInflater
import android.view.View
import androidx.fragment.app.FragmentActivity
import com.ellecity06.common.base.BaseDialog
import com.ellecity06.cwhiskymall.databinding.DialogNewerBinding

/**
 * @author ellecity06
 * @time 2024/12/27 10:55
 * @des
 */
class NewerDialog(activity: FragmentActivity, private val block: () -> Unit) :     BaseDialog<DialogNewerBinding>(activity),
View.OnClickListener {
    override val dimAmount: Float
    get() = 0.5F
    override val widthP: Float
        get() = 0.74F
    override fun inflaterViewBinding(): DialogNewerBinding {
        return DialogNewerBinding.inflate(LayoutInflater.from(context))
    }

    override fun initialize() {
        binding.tvReceive.setOnClickListener(this)
        binding.ivClose.setOnClickListener(this)
    }


    override fun onClick(view: View?) {
        when (view?.id) {
            binding.tvReceive.id -> {
                block.invoke()
                dismiss()
            }
            binding.ivClose.id -> {
                dismiss()
            }
        }
    }
}